package com.example.clock.ChangeTips;

import com.example.clock.Export.ExportData;
import com.example.clock.controlClass.DatabaseHelper;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;

import com.example.clock.R;
import com.example.clock.controlClass.SqlController;
import com.example.clock.lockedPage.MainActivity;
import com.example.clock.personalPage.PersonalPage;
import com.example.clock.planPage.PlanPage;
import com.example.clock.taskPage.TaskActivity;
import com.example.clock.timeAnalysisPage.TimeAnalysisPage;

import java.util.ArrayList;

public class testPage extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_page);
//提前准备：


        //获取数据库
        DatabaseHelper dbhelper = new DatabaseHelper(this,this);
        SQLiteDatabase db = dbhelper.getWritableDatabase();

//
//        Toast.makeText(this,ExportData.exportAllTaskToCSV(db,this, testPage.this), Toast.LENGTH_LONG).show();

//


//        SqlController.addBigTag(db,"第一个标签");
//        SqlController.addSmallTag(db,"第一个标签","第二个小标签");

        ArrayList arrayList = SqlController.getAllTags(db);



        //test 测试增加一天
        // Date d = new Date();Date d2 = SqlController.addDay(1,d);textView.setText(d.toString()+d2.toString());

        //测试创建task
//            Task task1 = new Task("1","第一个task","beizhu","2023-12-28","12:00:00","13:00:00",60,60,"xxx","yyy","3",1,1,1);
//            Task task2 = new Task("1","第er个task","beizhu","2023-12-27","12:00:00","13:00:00",60,60,"xxx","yyy","4",1,1,1);
//            SqlController.addTask(db,task1);
//            SqlController.addTask(db,task2);
        //测试根据日期查询task（某天）
//            ArrayList<Task> taskListByDay = SqlController.getTaskByDate(db,"2023-12-27");
        //测试（查找某几天task）
//            ArrayList<ArrayList<Task>> taskListMultiDay = SqlController.RangeSearchTaskByDate(db,"2023-12-27","2023-12-28");
//        新增plan
//            Plan plan1 = new Plan("12","第一个计划","2022-10-1","2022-10-2",15,15,15,15,"dsf","dsasz");
//            Plan plan2 = new Plan("12","第er个计划","2023-10-1","2022-10-2",15,15,15,15,"dsf","dsasz");
//            Plan plan3 = new Plan("12","第san计划","2023-10-2","2022-10-2",15,15,15,15,"dsf","dsasz");
//            Plan plan4 = new Plan("3","修改过的个计划","2024-10-1","2022-10-2",15,15,15,15,"dsf","dsasz");
//            SqlController.addPlan(db,plan1);
//            SqlController.addPlan(db,plan2);
//            SqlController.addPlan(db,plan3);
//            SqlController.addPlan(db,plan4);
        //删除plan
//            SqlController.deletePlan(db,"1");
        //查找所有plan
//            ArrayList<Plan> planArrayList= SqlController.getAllPlans(db);
        //查找特定日期plan（今日）
//            ArrayList<Plan> planArrayList2 = SqlController.getTodayPlans(db);
        //修改plan
//            SqlController.changePlan(db,plan4);

    }
    public void toPagePlan(View view){
        Intent intent = new Intent(testPage.this, PlanPage.class);
        startActivity(intent);
    }
    public void toPageMainActivity(View view){
        Intent intent = new Intent(testPage.this, MainActivity.class);
        startActivity(intent);
    }
    public void toPagePersonal(View view){
        Intent intent = new Intent(testPage.this, PersonalPage.class);
        startActivity(intent);
    }
    public void toPageTask(View view){
        Intent intent = new Intent(testPage.this, TaskActivity.class);
        startActivity(intent);
    }
    public void toPageTimeAnalysis(View view){
        Intent intent = new Intent(testPage.this, TimeAnalysisPage.class);
        startActivity(intent);
    }

    public void export(View v){

    }
}
